package com.yanqu.road.entity.activity.silkroad.entity;

public class SilkRoadCircle {
    private int x;
    private int y;
    private int r;

    public SilkRoadCircle(int x, int y, int r) {
        this.x = x;
        this.y = y;
        this.r = r;
    }

    public boolean isOverlap(SilkRoadCircle other) {
        // 计算两个圆心之间的距离
        double distance = Math.sqrt(Math.pow(this.x - other.x, 2) + Math.pow(this.y - other.y, 2));

        // 判断圆心距离是否小于两个圆形半径之和
        return distance < (this.r + other.r);
    }

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public int getY() {
        return y;
    }

    public void setY(int y) {
        this.y = y;
    }

    public int getR() {
        return r;
    }

    public void setR(int r) {
        this.r = r;
    }

    public void leftMove(int l){
        x = x - l;
    }
    public void rightMove(int l){
        x = x + l;
    }
    public void upMove(int l){
        y = y + l;
    }
    public void downMove(int l){
        y = y - l;
    }

}

